<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<meta name="author" content="zhangcheng">
	<title>操作员卡注销</title>
	<script language="javascript" src="../script/common.js" type="text/javascript"></script>
	<script language="javascript" src="../script/card.js" type="text/javascript"></script>
	<script language="javascript" type="text/javascript" src="../script/print.js"></script>
<script language="javascript" type="text/javascript">
	//页面控件初始化
	function load(){
		Eui.showNavigation();//导航
		setPages(["readcardview","detview"]);	
	}
	function onReadCard(){
		if(!checkForm(searchForm))return;			
		var asn = searchForm.asn.value
		DWR.call("mgntQueryService.getMgntCardInfo",asn,function(data){
			var card = data.card;
			var cardType = data.cardType;
			var shop = data.shop;
			if (!CardMgnt.checkRevocate(card,cardType,Constants.OPERATOR)) return;
			
			var cardObj = {
				asn : card.asn,
				subCardType : cardType.name,
				cardStatusText : Common.getText("card_status",card.status),
				shopName : shop.name,
				uniqueId : shop.uniqueId
			}
			Common.setValues(readCardForm,cardObj);
			$('revocateCardBtn').disabled = false
		},{blockScreen : true});
	}
	function revocateCard(){	
		DWR.call("cardMgntService.revocateCard",readCardForm.asn.value,function(data){		
			showInformation("卡片"+readCardForm.asn.value+"注销成功");
			switchPage("detview");
			Eui.getBillHtml("billview",{queryName:"kill_operator_bill",
				logId:data.logId
			})			
		},{blockScreen : true});
	}
	function onCancel(){
		readCardForm.reset();
		searchForm.reset();
		$('revocateCardBtn').disabled = true
	}
	function getCardAsn(){
		var asn;
		try{
			getCard();
			asn = getAsn();
		}catch(e){showError(e.description);return;}
		searchForm.asn.value = asn
	}
</script>
</head>
<body onload="load()" onunload="releaseCard()">
	<!--页面导航-->
	<div class="nav"><div id="nav">&nbsp;</div></div>
	
	<div id="readcardview">
		<div class="form">
			<div class="formTitle">操作员卡号</div>	
			<form id='searchForm' name="searchForm">
				<table cellSpacing="0" cellPadding="4" width="100%" border="0" align="center">
					<tr>
						<td>
							<label>卡&nbsp;&nbsp;&nbsp;&nbsp;号</label> 
							<input type="text" size="22" name="asn" value="" maxlength="16" onblur="checkV(this,'asn',true);">
							<button type="button" onclick="getCardAsn()">读卡号</button>			
						</td>
						<td><button type="button" name="search" onclick="onReadCard()">查  询</button></td>
					</tr>
				</table>
			</form>	
		</div>
		
			<div class="form">
				<div class="formTitle">操作员卡信息</div>
				<form id="readCardForm" name="readCardForm">
					<table cellSpacing="0" cellPadding="4" width="100%" border="0" class="label4">
						<tr>
							<td><label>卡 号</label> <input type="text" name="asn" readonly class="readonly"></td>
							<td><label>卡类型</label> <input type="text" name="subCardType" readonly class="readonly"></td>
						</tr>
						<tr>
							<td><label>卡状态</label> <input type="text" name="cardStatusText" readonly class="readonly"></td>
							<td><label>油站名称</label> <input type="text" name="shopName" maxlength="64" readonly class="readonly"></td>
						</tr>
						<tr>
							<td><label>油站编号</label> <input type="text" name="uniqueId" readonly class="readonly"></td>
						</tr>
					</table>
				</form>
			</div>
			
		<p>
			<button type="button" id="revocateCardBtn" onclick="revocateCard()" disabled>销 卡</button>
			<button type="button" onclick="onCancel()">重 置</button>
		</p>
	</div>	
	<div id="detview" class="form" style="width:100%;display:none;">
			<div class="formTitle">
				<div class="l">操作员卡注销凭证</div>
				<div class="r">
					<button onclick="WebPrint.preview('billview')">打印预览</button>
			 		<button onclick="WebPrint.print('billview')">打印</button>
			 		<button onclick="switchPage('readcardview');onCancel();">返 回</button>
				</div>
			</div>
			<div  id="billview" align='center'></div>
	</div>
</body>
</html>